#include <cstdio>

int main( )
{
    __int64 a[ 101 ], t, sum;
    int i, n;
    while ( scanf("%d", &n) && n )
    {
        sum = t = 0;
        for ( i = 0; i < n; i++ )
        {
            scanf("%I64d", &a[ i ]);
            if ( t < a[ i ] )
                t = a[ i ];
            sum += a[ i ];
        }
        sum += ( 2009 - n ) * t;
        printf("%I64d\n", sum);
    }
    return 0;
}
